let chatUser = sessionStorage.getItem('chatUser')
if (chatUser) {
    window.location.href = './index.html'
}
let nicknameInput = document.querySelector('.nickname')
let loginBtn = document.querySelector('.go')
let inputValue = ''
nicknameInput.oninput = function (params) {
    inputValue = nicknameInput.value;
    if (inputValue) {
        if (loginBtn.innerText === '请输入昵称') {
            loginBtn.innerText = '进入聊天 >'
        }
        loginBtn.classList.remove('none')
    } else {
        loginBtn.classList.add('none')
    }
}

loginBtn.onclick = function (params) {
    if (!inputValue) {
        loginBtn.innerText = '请输入昵称'
    } else {
        sessionStorage.setItem('chatUser',inputValue)
        window.location.href = './index.html'
    }
}